home *** CD-ROM | disk | FTP | other *** search
/ Chip: 2005 Utilities / CHIP Utilities 2005.7z / CHIP Utilities 2005.iso / images / freesco.igz / freesco.img / router / rc / rc_bridg < prev    next >
Encoding:
Text File  |  2002-11-06  |  634 b   |  37 lines

  1. #!/bin/sh
  2. #
  3.  
  4. . /etc/system.cfg
  5.  
  6. [ "$ROUTER" = bridge ] || exit
  7.  
  8. fn2()    { ifconfig eth0 | sed -n '/PROMISC/P'; }
  9. stp()    {
  10.     [ "`fn2`" ] || return
  11.     echo -n "Stopping bridge...            "
  12.     brcfg -disable >/dev/null        
  13.     for i in 0 1 2 3 4 5 6 7 8 9; do
  14.         ifconfig "eth$i" down
  15.     done
  16.     = 
  17. }
  18. str()    {
  19.     [ "`fn2`" ] && return
  20.     echo -n "Starting bridge...            "
  21.     for i in 0 1 2 3 4 5 6 7 8 9; do    
  22.         ifconfig "eth$i" up promisc allmulti
  23.     done
  24.     brcfg -enable >/dev/null        
  25.     =
  26. }
  27.  
  28. case "$1" in
  29.     start)    str;;
  30.     stop)    stp;;
  31.     restart)stp;str;;
  32.     status)    if [ "`fn2`" ]
  33.             then echo Bridging mode is enabled 
  34.             else echo Bridging mode is not running
  35.         fi;;
  36. esac
  37.